<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //模拟获取 用户数据 订单数据 商品数据
        function getUsers(){
            setTimeout(()=>{
                let data = '用户数据'; 
                it.next(data);
            },1000);
        }

        function getOrders(){
            setTimeout(()=>{
              let data = '订单数据';
              it.next(data);
            },1000)
        }

        function getCommodity(){
            setTimeout(() => {
                let data = '商品数据';
                it.next(data);
            }, 1000);
        }

        function * gen(){
           let useres =  yield getUsers();
           console.log(useres);
           let o =  yield getOrders();
           console.log(o);
           let c = yield getCommodity();
           console.log(c);
        }

        let it = gen();
        it.next();


    </script>
</body>
</html>